import request from "../request";

// 商城登录 token换token

export function shopApiLogin(token: string) {
  return request({
    url: "/user/login",
    method: "POST",
    data: {
      token
    }
  });
}

/**
 * @returns 地址列表
 */
export function GetAddressListApi() {
  return request({
    url: `/address/list`,
    data: {
      per_page: 10
    }
  });
}

/**
 * @returns 地址 - 新增/删除/编辑
 */
export function SetAddressApi(data: any, method: any) {
  return request({
    url: `/address`,
    data,
    method
  });
}

/**
 * @returns 获取商品列表
 */
//获取商品列表
export function shopApiProductList(data: any) {
  return request({
    url: "/product/list",
    method: "GET",
    isToken: false,
    data
  });
}

//获取商品列表
export function shopApiProduct(data: any) {
  return request({
    url: "/product",
    method: "GET",
    data,
    isToken: false
  });
}

//获取评论列表
export function shopApicommentList(data: any) {
  return request({
    url: "/comment/list",
    method: "GET",
    data
  });
}

// 确认下单
export function shopApiOrder(data: any) {
  return request({
    url: "/order",
    method: "POST",
    data
  });
}

// 轮播图
export function shopApiBanner(data?: any) {
  return request({
    url: "/banner/get-banner",
    method: "GET",
    data,
    isToken: false
  });
}

// 智能体分类列表
export function shopApiTypeList() {
  return request({
    url: "/ai-robot/type/list",
    method: "GET",
    isToken: false
  });
}

// 获取商品对应的sku信息
export function shopApigSkuList(data: any) {
  return request({
    url: "/product/getSkuList",
    method: "GET",
    data
  });
}

// 获取商品对应的sku产品
export function shopApigetSkuInfo(data: any) {
  return request({
    url: "/product/getSkuInfo",
    method: "GET",
    data
  });
}

// 获取商品推荐列表
export function shopApigetRecommendProduct(data: any) {
  return request({
    url: "/product/getRecommendProduct",
    method: "GET",
    data
  });
}

// 获取分类列表
export function shopApiGetCategory() {
  return request({
    url: "/category/getCategory",
    method: "GET"
  });
}
